package com.steven.im.ui.activity;

import android.annotation.SuppressLint;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.steven.im.R;
import com.steven.im.adapter.IMGroupInfoAdapter;
import com.steven.im.base.BaseActivity;
import com.steven.im.entity.IMGroupInfoEntity;
import com.steven.im.utils.TitleBuilder;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class IMGroupInfoActivity extends BaseActivity {
    @BindView(R.id.title_mid)
    TextView title_mid;
    @BindView(R.id.rc_group)
    RecyclerView rc_group;
    List<IMGroupInfoEntity> imGroupInfoEntities = new ArrayList<>();

    @Override
    public void setListen() {

    }

    @Override
    public void setTitleBarColor() {
        new TitleBuilder(this)
                .setLeftIcoListening(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        finish();
                    }
                });

    }

    @Override
    public int intiLayout() {
        return R.layout.activity_im_groupinfo;
    }

    @Override
    public void initView() {

    }

    @SuppressLint("SetTextI18n")
    @Override
    public void initData() {
        title_mid.setText("群聊信息（31）");
        imGroupInfoEntities.clear();
        for (int i = 0; i < 10; i++) {
            if (i < 9) {
                IMGroupInfoEntity imGroupInfoEntity = new IMGroupInfoEntity();
                imGroupInfoEntity.setName("小明");
                imGroupInfoEntity.setUrl("http://imgsrc.baidu.com/forum/w%3D580%3B/sign=3d5464e3922bd40742c7d3f54bb29c51/f703738da9773912876b7faafd198618377ae2a8.jpg");
                imGroupInfoEntities.add(imGroupInfoEntity);
            } else {
                IMGroupInfoEntity imGroupInfoEntity = new IMGroupInfoEntity();
                imGroupInfoEntity.setName("");
                imGroupInfoEntity.setUrl(R.drawable.add_friend);
                imGroupInfoEntities.add(imGroupInfoEntity);
            }
        }
        GridLayoutManager layoutManager = new GridLayoutManager(this, 5);
        IMGroupInfoAdapter imGroupChatListAdapter = new IMGroupInfoAdapter(imGroupInfoEntities);
        rc_group.setHasFixedSize(true);
        rc_group.setLayoutManager(layoutManager);
        rc_group.setAdapter(imGroupChatListAdapter);
    }
}
